package java;

/**
 * @author:谢君臣
 * @Date:2021/7/23-14:54
 * @version:1.0
 * @function:
 */
public class 类创建过程 {

    public static void main(String[] args) {
        B.test0();
        B a = new B();
        a.test();
    }
}
class A{
    private int data;
    static {
        System.out.println("静态代码块");
    }
    public A() {
        System.out.println("无参构造器");
    }
    public static void test0(){
        System.out.println("静态方法");
    }
    public void test(){
        System.out.println("普遍方法");
    }

}
class B extends A{
    private int data;
    static {
        System.out.println("子类静态代码块");
    }
    public B() {
        System.out.println("子类无参构造器");
    }

    public static void test0(){
        System.out.println("子类静态方法");
    }
    @Override
    public void test(){
        System.out.println("子类重写普遍方法");
    }
}
